package cn.big.bigd.biocode.convert;

import com.neovisionaries.i18n.CountryCode;

import javax.persistence.AttributeConverter;

/**
 *@Author wangfan
 *@Date 2017/12/4 14:47
 */

public class CountryConverter implements AttributeConverter<String, String> {

  @Override
  public String convertToDatabaseColumn(String code) {
      return code;

  }

  @Override
  public String convertToEntityAttribute(String code) {
    try {
      return CountryCode.getByCode(code).getName();
    } catch (Exception ex) {
      return null;
    }



  }

}